package com.zygh.lz.controller.pc;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zygh.lz.dao.SectionMapper;
import com.zygh.lz.entity.Section;
import com.zygh.lz.service.impl.PoliceDataService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@Api(tags = "接处警数据对接")
@RestController
@RequestMapping("/PoliceDataController")
public class PoliceDataController {

    @Resource
    private PoliceDataService policeDataService;
    @Resource
    private SectionMapper sectionMapper;


    @ApiOperation("接处警数据同步")
    @GetMapping("manager")
    public void manager(String startDate, String endDate) {
        policeDataService.manager(startDate, endDate);
    }

    @ApiOperation("接处警数据同步测试")
    @GetMapping("updatePolice")
    public void insertPolice(String result) {
        policeDataService.UpdateInsertPolice(result);
    }


     @GetMapping("getManage")
    public List<Section> getManage() {
         List<Section> sections = sectionMapper.selectList(Wrappers.<Section>lambdaQuery()
                 .eq(Section::getSectionPid, 74)
                 .isNotNull(Section::getSectionTel)
                 .or().eq(Section::getSectionTel, "410100170000"));
        return sections;
    }



}
